package org.example.javase.copy;

public class TestMain2 {
    public static void main(String[] args) throws CloneNotSupportedException {
        System.out.println("======深拷贝======");
        deepCloneTest();
    }

    /**
     * 深拷贝测试用例
     *
     * @throws CloneNotSupportedException
     */
    private static void deepCloneTest() throws CloneNotSupportedException {
        DeepCloneTest test = new DeepCloneTest();
        test.setDeepExperience("我是小明，我精通Java，C++的复制粘贴");
        test.show();
        DeepCloneTest cloneTest = (DeepCloneTest) test.clone();
        cloneTest.show();
        cloneTest.setDeepExperience("我是小明的副本，我精通Java,C++");
        cloneTest.show();
        test.show();
        System.out.println(cloneTest.getAge());
    }
}
